         
    DEFINE INPUT PARAMETER p-site LIKE si_site.
    DEFINE INPUT PARAMETER p-part LIKE pt_part.
/*    DEFINE OUTPUT PARAMETER p-req LIKE tr_qty_loc. */

    DEFINE OUTPUT PARAMETER p-iss LIKE tr_qty_loc.

    DEFINE VARIABLE p-start AS DATE.
    DEFINE VARIABLE p-end AS DATE.

    p-end = DATE(MONTH(TODAY), 1, YEAR(TODAY)) - 1.
    p-start = DATE(MONTH(p-end), 1, YEAR(p-end)).

/*    p-req = 0.    */
    p-iss = 0.

/*
    FOR EACH wod_det NO-LOCK WHERE wod_site = p-site AND wod_part = p-part,
        EACH wo_mstr NO-LOCK WHERE wo_lot = wod_lot AND wo_nbr = wod_nbr AND wo_nbr > "W" 
        AND wo_rel_date >= p-start AND wo_rel_date <= p-end
        AND (wo_status = "R" OR (wo_status = "C" AND wo_stat_close_date >= p-start AND wo_stat_close_date <= p-end)):
        p-req = p-req + wod_qty_req.
    END.
*/    
    FOR EACH tr_hist NO-LOCK WHERE tr_site = p-site AND tr_part = p-part AND tr_type = "ISS-WO"
        AND tr_effdate >= p-start AND tr_effdate <= p-end :
        p-iss = p-iss + tr_qty_loc.
    END.
